﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:mr="http://mishrareader.codeplex.com/Reader"
                    xmlns:mishraReader="clr-namespace:MishraReader;assembly=MishraReader.ViewModels"
                    xmlns:viewModels="clr-namespace:MishraReader.ViewModels;assembly=MishraReader.ViewModels">

    <DataTemplate x:Key="autoSignInTemplate">
        <Grid Background="Transparent" TextOptions.TextFormattingMode="Display">
            <mr:BusyIndicator 
            Width="200" 
            VerticalAlignment="Center" 
            IsBusy="true" 
            BusyMessage="{x:Static mishraReader:Strings.SigningIn}" />
        </Grid>
    </DataTemplate>
    <DataTemplate x:Key="disconnected" DataType="{x:Type viewModels:SignInViewModel}">
        <Grid>
            <mr:Dialog 
                Title="Unused"
                Showing="{Binding ShowData}" 
                Content="{Binding}"
                />
        </Grid>
    </DataTemplate>
    <DataTemplate DataType="{x:Type viewModels:MainViewModel}">
        <ContentPresenter x:Name="content" Content="{x:Null}"  />
        <DataTemplate.Triggers>
            <DataTrigger Binding="{Binding Status}" Value="Connected">
                <Setter TargetName="content" Property="Content" Value="{Binding Reader}" />
            </DataTrigger>
            <DataTrigger Binding="{Binding EditSettings}" Value="True">
                <Setter TargetName="content" Property="Content" Value="{Binding Settings}" />
            </DataTrigger>
            <DataTrigger Binding="{Binding Status}" Value="AutoConnecting">
                <Setter TargetName="content" Property="ContentTemplate" Value="{StaticResource autoSignInTemplate}" />
            </DataTrigger>
            <DataTrigger Binding="{Binding Status}" Value="Disconnected">
                <Setter TargetName="content" Property="Content" Value="{Binding SignIn}" />
                <Setter TargetName="content" Property="ContentTemplate" Value="{StaticResource disconnected}" />
            </DataTrigger>
        </DataTemplate.Triggers>
    </DataTemplate>
</ResourceDictionary>